package com.company;

import java.util.Random;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
	// write your code here
        Scanner scanner = new Scanner(System.in);
        Random random = new Random();
        int b = random.nextInt(100);
        int i = 7;
        while (i > 0){
            System.out.println("还剩" + i + "次机会！");
            System.out.println("请输入一个100以内数字：");
            int a = scanner.nextInt();
            if (a < b){
                System.out.print("猜小了！");
            }else if (a > 7){
                System.out.print("猜大了！");
            }else {
                System.out.print("猜对了！");
                return;
            }
            i--;
            if (i == 0){
                System.out.println("次数用光啦！");
                return;
            }
        }
    }
}
